import requests
import app
class LoginAPI(object):
    def __init__(self):
        self.url = app.BASE_URL+'/api/sys/login'
        self.headers = app.HEADERS

    def login(self,json_data):
        resp=requests.post(url=self.url,headers=self.headers,json=json_data)
        return resp

class EmpManage(object):
    def __init__(self):
        self.url = app.BASE_URL +'/api/sys/user'
    def login_ok(self):
        pass
    def add_emp(self,headers,rep_data):
        return  requests.post(url=self.url,headers=headers,json=red_data)
    def query_emp(self, emp_id, headers):
        return requests.get(url=self.url + '/' + emp_id, headers=headers)

    def modify_emp(self, emp_id, headers, req_data):
        return requests.put(url=self.url + '/' + emp_id, headers=headers, json=req_data)

    def delete_emp(self, emp_id, headers):
        return requests.delete(url=self.url + '/' + emp_id, headers=headers)

    def query_emp_list(self, headers):
        return requests.get(url=app.BASE_URL + '/api/sys/user?page=1&size=10', headers=headers)


